Repository navigation
fix(codegen-ts): keep credentials out of generated grids - #616
Merged
Merged
Conversation
…ial sort and filter presets The generated forms skipped a view.password field, but the TanStack and Angular grids emitted a column for it whenever a layout.dataGrid named it (or listed no @columns), and a @defaultSortField naming one became the grid's initial sort. Columns are now dropped and the sort resolves to none in every tier, counting a column any TPH subtype marks as a credential on a base's polymorphic grid. A @filter preset over a credential fails meta gen instead of being emitted. The agent UI page marks a credential as excluded and leaves it out of grid columns and default sort.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
view.password), even when@columnsnames it. A@defaultSortFieldnaming a credential now resolves to no initial sort. On a TPH base's grid, a credential marked by any subtype counts. The sharedcredentialFieldNames()helper incodegen-tsbacks this, andresolveGridDefaultSort()takes an optionalrootto check it.@filterpreset over a credential, at anyand/ordepth, now failsmeta genand names the layout and field. Before, it emitted a filter the server refuses on every request.buildGrid()inruntime-web, and the docs and CHANGELOG follow the same rules. The agent UI page marks a credential as form-excluded. Value-object (nested) credentials stay a documented known limit.Validation
Risk Assessment
✅ Low: The change is bounded and consistent: credential columns and initial sorts are dropped in every generated or runtime grid tier, with execution-based tests, and the previously flagged runtime-web sibling is now fixed.
Testing
Drove two scenarios live through the real
meta genCLI (run from source with bun) on synthetic scratch projects, then removed the scratch. S1: a plain entity with a password field generates a grid with onlyemail(pinHash dropped from columns and default sort) and agent/ui.md listscolumns: emailwith no default sort. S2 (adversarial TPH): the Auth base grid drops both the subtype-only credentialpinand the sibling-markedcode, in Auth.columns.tsx and in the agent page for all three grids, and keeps the non-credentialtypeandidcolumns. Focused credential tests (10) pass. Overall: pass. Not driven: the runtime-webbuildGridtwin (outside the generated-UI intent) and the React/Angular form generators (not wired in these projects; existing per-object form rule unchanged). Note: the BridgeAuthcodeform row shows as a plain text field, consistent with the per-object form rule.meta genrun from source in a scratch project; output src/generated/Account.columns.tsx has only the email column and no initialSort; docs/generated/agent/ui.md grid section reads- columns: \emai…meta genrun from source; Auth.columns.tsx lists only type and id; agent ui.md shows- columns: \type`, `id`` for Auth, BridgeAuth and CouponAuth; grep for pin/code in grid output finds nothing…Evidence: S1 plain entity: generated grid columns file (pinHash absent)
Evidence: S1 plain entity: agent ui.md grid section
Evidence: S2 TPH: generated Auth grid columns file (pin and code absent)
Evidence: S2 TPH: agent ui.md (grid columns type,id for all three objects)
Evidence: S1/S2 input metadata
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
🔧 **Test** - 2 issues found → auto-fixed ✅
server/typescript/packages/codegen-ts/src/generators/agent-ui-page.ts:192- Livemeta gen(agentDocsFile) on a TPH model: agent/ui.md Auth grid listscolumns: type, id, pin, codeand CouponAuth grid listspin. The generated Auth.columns.tsx drops pin and code. Cause: gridSection (line 192) calls credentialFieldNames(obj, root) on the base only; that hierarchy misses subtype-only credentials (pin) and sibling-marked shared columns (code). Probe: credentialFieldNames(Auth, root) = [], BridgeAuth = [pin, code], CouponAuth = [code]. Fix: build the credential set as the union over tphHierarchy(obj, root), as gridCredentialNames does in the tanstack tier. Also add a live-equivalent assertion on a TPH base in the codegen-ts test. Simple, about 5 lines in 1 file. Repair is within intent (UI-side leak), not a policy change.columns: type, id, pin, codeon the Auth grid andpinon CouponAuth's grid (fail)scripts/ci-local.sh --affected --strict-toolchainsBaseline (given):scripts/ci-local.sh --affected --strict-toolchainspassed at 1c1e5ac16; not re-run (no source change in this phase)bun {run-worktree}/server/typescript/packages/cli/bin/meta.ts genin /mnt/scratch/cred-validate (target commit, Account + Session + TPH Auth model, generators entityFile, queriesFile, routesFile, formFile, tanstackQuery, tanstackGrid, tanstackGridHook, barrel, agentDocsFile)Same model regenerated with the base b78da0f29 CLI and packages (git archive, isolated node_modules) in /mnt/scratch/base-proj, as the before-fix reproductionDiff of generated Account.columns.tsx, Account.grid.ts, Account.form.tsx and Auth.columns.tsx, base vs fixed; agent/ui.md read from bothbun test test/credential-grid-column.test.tsin codegen-ts-tanstack (7 pass), codegen-ts-angular (3 pass)bun test test/agent-ui-credential.test.tsin codegen-ts (2 pass)bun test test/grid-from-metadata.test.tsin client/web/packages/runtime-web (13 pass)Scenario-to-command mapping: S1 and S2 driven bymeta gen; S3 is the TPH case through the samemeta gen; S4 is covered by focused test only🔧 Fix applied.
✅ Re-checked - no issues remain.
meta genrun from source in a scratch project; output src/generated/Account.columns.tsx has only the email column and no initialSort; docs/generated/agent/ui.md grid section reads- columns: \emai…meta genrun from source; Auth.columns.tsx lists only type and id; agent ui.md shows- columns: \type`, `id`` for Auth, BridgeAuth and CouponAuth; grep for pin/code in grid output finds nothing…scripts/ci-local.sh --affected --strict-toolchainsBaseline:scripts/ci-local.sh --affected --strict-toolchains(already passed at target commit 1ff07b0df; not re-run, no source changes in this turn)Live S1:bun server/typescript/packages/cli/bin/meta.ts genin a scratch project with a plain Account entity (email + pinHash with view.password, grid @columns [email,pinHash], @defaultSortField pinHash), generators tanstackGrid + agentDocsFileLive S2 (adversarial TPH):meta genon Auth/BridgeAuth/CouponAuth (pin is password on BridgeAuth only; code is password on CouponAuth only, plain on BridgeAuth)bun test packages/codegen-ts/test/agent-ui-credential.test.ts packages/codegen-ts-tanstack/test/credential-grid-column.test.tsin server/typescript (10 pass, 0 fail)Evidence recorded as s1-plain and s2-tph; scratch project under DEV_SCRATCH removed✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.